<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  var arr = function (head) {
    slow = fast = head;
    while (fast && fast.next) {//快慢指针遍历，直到快指针到达最后
      slow = slow.next;
      fast = fast.next.next;
    }
    return slow;
  };
  console.log(arr(head = [1, 2, 3, 4, 5]));
</script>

</html>